package cn.ejiakanghu.logistics.service.impl;

import cn.com.ejiakanghu.core.exceptions.BizException;
import cn.ejiakanghu.logistics.service.MaintainService;
import cn.hutool.core.util.StrUtil;
import org.linlinjava.litemall.db.dao.AgedmallLgBaseInfoMapper;
import org.linlinjava.litemall.db.dao.AgedmallLgMissionMapper;
import org.linlinjava.litemall.db.dao.AgedmallLgReceiveOrderMapper;
import org.linlinjava.litemall.db.dao.LitemallOrderGoodsMapper;
import org.linlinjava.litemall.db.domain.*;
import org.linlinjava.litemall.db.util.BaseInfoLogisticsStatusErrorMessageEnum;
import org.linlinjava.litemall.db.util.LgBaseInfoStatConstant;
import org.linlinjava.litemall.db.util.LgMissionIsOverEum;
import org.linlinjava.litemall.db.util.LogisticsMissionTypeEnum;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * @author ：sujp
 * @date ：Created in 2021/11/16 11:30
 * @description：维护相关操作
 * @modified By：
 * @version: V1.0
 */
@Service
public class MaintainServiceImpl extends LogisticBusiBaseServiceImpl implements MaintainService {
    @Resource
    private LogisticsBaseServiceAbstractImpl logisticsBaseServiceAbstractImpl;

    /**
     * 设备维护中
     *
     * @param manId
     * @param missionId
     * @param messageType
     * @param receiveType
     * @param execType
     */
    @Override
    public void equipmentUnderMaintenance(Integer manId, Integer missionId, Integer messageType, Integer receiveType, Integer execType) {
        logisticsBaseServiceAbstractImpl.logisticsEventInProgress(manId, missionId, messageType, receiveType, execType);
    }

    /**
     * 设备维护完成
     *
     * @param missionId
     * @param imgs
     */
    @Override
    public void equipmentMaintenanceCompleted(Integer missionId, List<String> imgs) {
        //新增 busireceiveorder busiimg  baseInfo当前物流状态 业务是否结束更新   mission表的状态更新
        //根据missionId更新物流信息
        logisticsBaseServiceAbstractImpl.pickingCompleteOperation(missionId, imgs, LgBaseInfoStatConstant.MAINTAINING, LgBaseInfoStatConstant.MAINTAIN_COMPLETE, BaseInfoLogisticsStatusErrorMessageEnum.NOT_UNDER_MAINTENANCE.getMessage());
    }
}
